﻿<UserControl x:Class="Big3.Hitbase.MainControls.TrackListDetails"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
             xmlns:misc="clr-namespace:Big3.Hitbase.Miscellaneous;assembly=Misc"
             xmlns:controls="clr-namespace:Big3.Hitbase.Controls;assembly=Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" x:Name="trackListDetails">
    <UserControl.Resources>
        <misc:StringToVisibilityConverter x:Key="stringToVisibility" />
    </UserControl.Resources>
    <ListBox x:Name="listBox" Background="Transparent" BorderThickness="0" 
                 HorizontalContentAlignment="Stretch"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Auto" 
                 ItemContainerStyle="{StaticResource MyListBoxItemContainerStyle}"
                 MouseDoubleClick="itemsControl_MouseDoubleClick">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border Width="250" Height="140" Name="ItemContainer" BorderThickness="1" CornerRadius="5" BorderBrush="Transparent" >
                    <DockPanel Name="GridRow" Background="Transparent" >
                        <StackPanel DockPanel.Dock="Left" Orientation="Vertical">
                            <controls:ChoosePictureUserControl VerticalAlignment="Top" ImageWatermark="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/MissingPersonGroupImage.png" 
                                                               ButtonText="" ImageFilename="{Binding Path=ImageFilename}" Height="80" Width="80" 
                                                               Margin="0,5,10,10" Artist="{Binding Name}" DataBase="{Binding DataBase, ElementName=trackListDetails}" CoverType="PersonGroup" 
                                                               ImageChanged="ChoosePictureUserControl_ImageChanged">
                                                               
                            </controls:ChoosePictureUserControl>
                            <!--<controls:ChoosePictureFastUserControl VerticalAlignment="Top"  InitialImageFilename="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/MissingPersonGroupImage.png"
                                                               ImageFilename="{Binding Path=ImageFilename, IsAsync=True}" Height="80" Width="80" 
                                                               Margin="0,5,10,10"  >

                            </controls:ChoosePictureFastUserControl>-->
                            <!--<Image VerticalAlignment="Top" Source="{Binding Path=ImageFilename, IsAsync=True}" Height="80" Width="80" 
                                                               Margin="0,5,10,10"  >
                            </Image>-->
                            <Grid HorizontalAlignment="Center">
                                <TextBlock Width="80" Text="{Binding TimeSpan}" Margin="0 2 0 2" TextWrapping="Wrap" />
                            </Grid>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding Name}" FontWeight="Bold" TextTrimming="CharacterEllipsis" Margin="0 2 0 2" />
                            <TextBlock Text="{Binding TypeAndSex}" Margin="0 2 0 2"  />
                            <TextBlock Margin="0 2 0 2" Visibility="{Binding Url, Converter={StaticResource stringToVisibility}}">
                                <Hyperlink Click="Hyperlink_Click"> 
                                    <Run Text="{Binding Url}" />
                                </Hyperlink>
                            </TextBlock>
                            <TextBlock Text="{Binding LandOfOrigin}" Margin="0 2 0 2" Visibility="{Binding LandOfOrigin, Converter={StaticResource stringToVisibility}}"/>
                            <controls:RatingUserControl HorizontalAlignment="Left" Rating="{Binding Rating}" Margin="0 2 0 2" ReadOnly="True" />
                            <TextBlock Margin="0 2 0 2">
                                <TextBlock.Text>
                                    <Binding StringFormat="Anzahl Tracks: {0}" Path="Count"> 
                                                
                                    </Binding>
                                </TextBlock.Text>
                            </TextBlock>
                        </StackPanel>
                    </DockPanel>
                </Border>
                <DataTemplate.Triggers>
                    <Trigger SourceName="ItemContainer" Property="IsMouseOver" Value="True">
                        <Setter TargetName="ItemContainer" Property="Background" >
                            <Setter.Value>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <LinearGradientBrush.GradientStops>
                                        <!--<GradientStop Color="#F8FBFE" Offset="0" />
                                            <GradientStop Color="#E8F2FE" Offset="1" />-->
                                        <GradientStop Color="#90FFFFFF" Offset="0" />
                                        <GradientStop Color="#30FFFFFF" Offset="1" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                        <Setter TargetName="ItemContainer" Property="BorderBrush" Value="#400000FF" />
                    </Trigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ListBox.ItemTemplate>
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <misc:VirtualizingTilePanel ChildSize="250,140"/>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
<!--        <ListBox.Template>
            <ControlTemplate>
                <ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}">
                    <ItemsPresenter />
                </ScrollViewer>
            </ControlTemplate>
        </ListBox.Template>   --> 
    </ListBox>
</UserControl>
